(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     27899,        730]
NotebookOptionsPosition[     25132,        628]
NotebookOutlinePosition[     25568,        647]
CellTagsIndexPosition[     25525,        644]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell["Project Euler 1-10", "Title",
 CellChangeTimes->{
  3.825800593745206*^9, {3.8263444198818674`*^9, 3.8263444208418674`*^9}},
 TextAlignment->Center],

Cell[CellGroupData[{

Cell["\[FilledSquare]1. Multiples of 3 and 5", "Subsubsection",
 CellChangeTimes->{3.825800627408572*^9}],

Cell["\<\
If we list all the natural numbers below 10 that are multiples of 3 or 5, we \
get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the \
multiples of 3 or 5 below 1000.\
\>", "Text",
 CellChangeTimes->{3.8258006477536063`*^9}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"AbsoluteTiming", "[", 
  RowBox[{
   RowBox[{"Select", "[", 
    RowBox[{
     RowBox[{"Range", "[", "999", "]"}], ",", 
     RowBox[{
      RowBox[{"Or", "[", 
       RowBox[{
        RowBox[{"Divisible", "[", 
         RowBox[{"#", ",", "3"}], "]"}], ",", 
        RowBox[{"Divisible", "[", 
         RowBox[{"#", ",", "5"}], "]"}]}], "]"}], "&"}]}], "]"}], "//", 
   "Total"}], "]"}]], "Code",
 CellChangeTimes->{3.825800668543685*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"0.0023805971268628144`", ",", "233168"}], "}"}]], "Output",
 CellChangeTimes->{3.825800672340065*^9}]
}, Open  ]],

Cell["More efficient solution", "Text",
 CellChangeTimes->{3.8258007009949303`*^9}],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"SumDivisibleBy", "[", 
    RowBox[{"max_", ",", "n_"}], "]"}], " ", ":=", " ", 
   RowBox[{"Module", "[", 
    RowBox[{
     RowBox[{"{", "}"}], ",", "\n", "\t", 
     RowBox[{
      RowBox[{"p", "=", 
       RowBox[{"Quotient", "[", 
        RowBox[{"max", ",", "n"}], "]"}]}], ";", "\n", "\t", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{"n", "*", "p", "*", 
         RowBox[{"(", 
          RowBox[{"p", "+", "1"}], ")"}]}], ")"}], "/", "2"}]}]}], "\n", 
    "]"}]}], ";"}], "\n", 
 RowBox[{"AbsoluteTiming", "[", 
  RowBox[{
   RowBox[{"SumDivisibleBy", "[", 
    RowBox[{"999", ",", "3"}], "]"}], "+", 
   RowBox[{"SumDivisibleBy", "[", 
    RowBox[{"999", ",", "5"}], "]"}], "-", 
   RowBox[{"SumDivisibleBy", "[", 
    RowBox[{"999", ",", "15"}], "]"}]}], "]"}]}], "Code",
 CellChangeTimes->{{3.8258007193637667`*^9, 3.825800747781608*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"0.00003473595542429575`", ",", "233168"}], "}"}]], "Output",
 CellChangeTimes->{3.825800751438974*^9}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]2. Even Fibonacci numbers", "Subsubsection",
 CellChangeTimes->{3.82580077140097*^9}],

Cell["\<\
Each new term in the Fibonacci sequence is generated by adding the previous \
two terms. By starting with 1 and 2, the first 10 terms will be:1, 2, 3, 5, \
8, 13, 21, 34, 55, 89, ...By considering the terms in the Fibonacci sequence \
whose values do not exceed four million, find the sum of the even-valued \
terms.\
\>", "Text",
 CellChangeTimes->{3.825800785096339*^9}],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"Module", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{
      RowBox[{"sum", "=", "0"}], ",", "fibonaccii"}], "}"}], ",", "\n", 
    RowBox[{
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", " ", "=", " ", "0"}], ",", " ", 
       RowBox[{
        RowBox[{"fibonaccii", " ", "=", " ", 
         RowBox[{"Fibonacci", "[", "i", "]"}]}], ";", 
        RowBox[{"fibonaccii", " ", "<", " ", "max"}]}], " ", ",", 
       RowBox[{"i", "++"}], " ", ",", 
       RowBox[{"If", "[", 
        RowBox[{
         RowBox[{"EvenQ", "[", "fibonaccii", "]"}], ",", 
         RowBox[{"sum", "+=", "fibonaccii"}]}], "]"}]}], "]"}], ";", "\n", 
     "sum"}]}], "\n", "]"}], ";"}], "\n", 
 RowBox[{"AbsoluteTiming", "[", 
  RowBox[{"EvenFibonacci", "[", 
   RowBox[{"4", "*", 
    RowBox[{"10", "^", "6"}]}], "]"}], "]"}]}], "Code",
 CellChangeTimes->{{3.8258008038272123`*^9, 3.8258008082036495`*^9}}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"3.94726766185179`*^-6", ",", 
   RowBox[{"EvenFibonacci", "[", "4000000", "]"}]}], "}"}]], "Output",
 CellChangeTimes->{3.8258008105328827`*^9}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]3. Largest prime factor", "Subsubsection",
 CellChangeTimes->{3.8258008243672657`*^9}],

Cell["\<\
The prime factors of 13195 are 5, 7, 13 and 29.What is the largest prime \
factor of the number 600851475143 ?\
\>", "Text",
 CellChangeTimes->{3.8258008329071198`*^9}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"Last", "[", 
   RowBox[{"FactorInteger", "[", "600851475143", "]"}], "]"}], "[", 
  RowBox[{"[", "1", "]"}], "]"}]], "Code",
 CellChangeTimes->{3.825800840620891*^9}],

Cell[BoxData["6857"], "Output",
 CellChangeTimes->{3.825800841738003*^9}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]4. Largest palindrome product", "Subsubsection",
 CellChangeTimes->{3.8258008487087*^9}],

Cell["\<\
A palindromic number reads the same both ways. The largest palindrome made \
from the product of two 2-digit numbers is 9009 = 91 * 99.Find the largest \
palindrome made from the product of two 3-digit numbers.\
\>", "Text",
 CellChangeTimes->{3.825800863350164*^9}],

Cell[BoxData["906609"], "Output",
 CellChangeTimes->{
  3.825805785194313*^9, 3.8258058172195153`*^9, 3.8258059192277155`*^9, 
   3.8258115496197076`*^9, {3.8258115944211874`*^9, 3.825811601062851*^9}, 
   3.825811848840701*^9, {3.825811881843701*^9, 3.8258119098797007`*^9}, {
   3.8258119418397007`*^9, 3.8258119753467007`*^9}, 3.8258120225047007`*^9, {
   3.825812069015701*^9, 3.825812088800701*^9}, 3.82581245463721*^9, 
   3.8258125195336986`*^9, {3.825812613349079*^9, 3.825812627117456*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]5. Smallest multiple", "Subsubsection",
 CellChangeTimes->{3.8258008487087*^9, 3.825812787605503*^9, 
  3.825813202142953*^9}],

Cell["\<\
2520 is the smallest number that can be divided by each of the numbers from 1 \
to 10 without any remainder.What is the smallest positive number that is \
evenly divisible by all of the numbers from 1 to 20?\
\>", "Text",
 CellChangeTimes->{
  3.825800863350164*^9, {3.825813207737512*^9, 3.8258132130720453`*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"LCM", "@@", 
  RowBox[{"Range", "[", "20", "]"}]}]], "Code",
 CellChangeTimes->{{3.8258008701748466`*^9, 3.825800870184847*^9}, {
   3.8258013206097546`*^9, 3.825801324839755*^9}, {3.8258033293847523`*^9, 
   3.8258033489527087`*^9}, {3.8258034756953816`*^9, 3.825803653118122*^9}, {
   3.8258047718267374`*^9, 3.8258048613359365`*^9}, {3.825804929705773*^9, 
   3.8258049965254545`*^9}, {3.825805069542755*^9, 3.8258050827080717`*^9}, {
   3.825805684929288*^9, 3.825805685070302*^9}, {3.8258057231001043`*^9, 
   3.8258058436941624`*^9}, {3.8258059055603485`*^9, 3.8258059180736*^9}, {
   3.8258112762853765`*^9, 3.825811277207469*^9}, {3.825811542295975*^9, 
   3.825811549134659*^9}, {3.8258115889526405`*^9, 3.825811600162761*^9}, {
   3.8258118480897007`*^9, 3.8258119747707005`*^9}, 3.825812021009701*^9, {
   3.825812063630701*^9, 3.8258120884047008`*^9}, {3.8258123172877007`*^9, 
   3.8258123562703743`*^9}, {3.8258124007208185`*^9, 3.825812473061052*^9}, {
   3.8258125155913043`*^9, 3.82581251714646*^9}, {3.825812611664911*^9, 
   3.8258126249372377`*^9}, {3.825813796642397*^9, 3.8258138394896812`*^9}}],

Cell[BoxData["232792560"], "Output",
 CellChangeTimes->{3.8258138755602875`*^9}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]6. Sum square difference", "Subsubsection",
 CellChangeTimes->{
  3.8258008487087*^9, 3.825812787605503*^9, 3.825813202142953*^9, {
   3.8258139508788185`*^9, 3.825813952678999*^9}}],

Cell[TextData[{
 "The sum of the squares of the first ten natural numbers is,",
 Cell[BoxData[
  FormBox[
   TagBox[
    RowBox[{
     RowBox[{
      SuperscriptBox["1", "2"], "+", 
      SuperscriptBox["2", "2"], "+", 
      RowBox[{".", ".", ".", 
       RowBox[{"+", 
        SuperscriptBox["10", "2"]}]}]}], "=", "385"}],
    "MathMLPresentationTag",
    AutoDelete->True], TraditionalForm]]],
 "\nThe square of the sum of the first ten natural numbers is,",
 Cell[BoxData[
  FormBox[
   RowBox[{
    StyleBox[" ",
     SpanMinSize->1.,
     SpanMaxSize->1.], 
    RowBox[{
     SuperscriptBox[
      RowBox[{
       StyleBox["(",
        SpanMinSize->1.,
        SpanMaxSize->1.], 
       RowBox[{"1", "+", "2", "+", 
        RowBox[{".", ".", ".", 
         RowBox[{"+", "10"}]}]}], 
       StyleBox[")",
        SpanMinSize->1.,
        SpanMaxSize->1.]}], "2"], "=", 
     RowBox[{
      SuperscriptBox["55", "2"], "=", "3025"}]}]}], TraditionalForm]]],
 "\nHence the difference between the sum of the squares of the first ten \
natural numbers and the square of the sum is",
 Cell[BoxData[
  FormBox[
   RowBox[{" ", 
    RowBox[{
     RowBox[{"3025", "\[Minus]", "385"}], "=", "2640"}]}], TraditionalForm]]],
 "\nFind the difference between the sum of the squares of the first one \
hundred natural numbers and the square of the sum.20?"
}], "Text",
 CellChangeTimes->{
  3.825800863350164*^9, {3.825813207737512*^9, 3.8258132130720453`*^9}, {
   3.825813959910722*^9, 3.825813991831914*^9}, {3.825814150483777*^9, 
   3.8258141936080894`*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{
    RowBox[{"#", "^", "2"}], "&"}], "@", 
   RowBox[{"Total", "[", 
    RowBox[{"Range", "[", "100", "]"}], "]"}]}], "-", 
  RowBox[{"Total", "[", 
   RowBox[{
    RowBox[{
     RowBox[{"#", "^", "2"}], "&"}], "@", 
    RowBox[{"Range", "[", "100", "]"}]}], "]"}]}]], "Code",
 CellChangeTimes->{{3.8258008701748466`*^9, 3.825800870184847*^9}, {
   3.8258013206097546`*^9, 3.825801324839755*^9}, {3.8258033293847523`*^9, 
   3.8258033489527087`*^9}, {3.8258034756953816`*^9, 3.825803653118122*^9}, {
   3.8258047718267374`*^9, 3.8258048613359365`*^9}, {3.825804929705773*^9, 
   3.8258049965254545`*^9}, {3.825805069542755*^9, 3.8258050827080717`*^9}, {
   3.825805684929288*^9, 3.825805685070302*^9}, {3.8258057231001043`*^9, 
   3.8258058436941624`*^9}, {3.8258059055603485`*^9, 3.8258059180736*^9}, {
   3.8258112762853765`*^9, 3.825811277207469*^9}, {3.825811542295975*^9, 
   3.825811549134659*^9}, {3.8258115889526405`*^9, 3.825811600162761*^9}, {
   3.8258118480897007`*^9, 3.8258119747707005`*^9}, 3.825812021009701*^9, {
   3.825812063630701*^9, 3.8258120884047008`*^9}, {3.8258123172877007`*^9, 
   3.8258123562703743`*^9}, {3.8258124007208185`*^9, 3.825812473061052*^9}, {
   3.8258125155913043`*^9, 3.82581251714646*^9}, {3.825812611664911*^9, 
   3.8258126249372377`*^9}, {3.825813796642397*^9, 3.8258138394896812`*^9}, {
   3.825814397362463*^9, 3.8258144035930853`*^9}}],

Cell[BoxData["25164150"], "Output",
 CellChangeTimes->{3.8258138755602875`*^9, 3.825814405156242*^9}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]7. 10001st prime", "Subsubsection",
 CellChangeTimes->{
  3.8258008487087*^9, 3.825812787605503*^9, 3.825813202142953*^9, {
   3.8258139508788185`*^9, 3.825813952678999*^9}, {3.8258144552442503`*^9, 
   3.825814460499776*^9}}],

Cell["\<\
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see \
that the 6th prime is 13.What is the 10 001st prime number?\
\>", "Text",
 CellChangeTimes->{
  3.825800863350164*^9, {3.825813207737512*^9, 3.8258132130720453`*^9}, {
   3.825813959910722*^9, 3.825813991831914*^9}, {3.825814150483777*^9, 
   3.8258141936080894`*^9}, {3.8258144654182673`*^9, 3.8258144700907345`*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Prime", "[", "10001", "]"}]], "Code",
 CellChangeTimes->{{3.8258008701748466`*^9, 3.825800870184847*^9}, {
   3.8258013206097546`*^9, 3.825801324839755*^9}, {3.8258033293847523`*^9, 
   3.8258033489527087`*^9}, {3.8258034756953816`*^9, 3.825803653118122*^9}, {
   3.8258047718267374`*^9, 3.8258048613359365`*^9}, {3.825804929705773*^9, 
   3.8258049965254545`*^9}, {3.825805069542755*^9, 3.8258050827080717`*^9}, {
   3.825805684929288*^9, 3.825805685070302*^9}, {3.8258057231001043`*^9, 
   3.8258058436941624`*^9}, {3.8258059055603485`*^9, 3.8258059180736*^9}, {
   3.8258112762853765`*^9, 3.825811277207469*^9}, {3.825811542295975*^9, 
   3.825811549134659*^9}, {3.8258115889526405`*^9, 3.825811600162761*^9}, {
   3.8258118480897007`*^9, 3.8258119747707005`*^9}, 3.825812021009701*^9, {
   3.825812063630701*^9, 3.8258120884047008`*^9}, {3.8258123172877007`*^9, 
   3.8258123562703743`*^9}, {3.8258124007208185`*^9, 3.825812473061052*^9}, {
   3.8258125155913043`*^9, 3.82581251714646*^9}, {3.825812611664911*^9, 
   3.8258126249372377`*^9}, {3.825813796642397*^9, 3.8258138394896812`*^9}, {
   3.825814397362463*^9, 3.8258144035930853`*^9}, {3.825814494673193*^9, 
   3.825814528216547*^9}}],

Cell[BoxData["104743"], "Output",
 CellChangeTimes->{
  3.8258138755602875`*^9, 3.825814405156242*^9, {3.825814513840109*^9, 
   3.825814528618587*^9}}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]8. Largest product in a series", "Subsubsection",
 CellChangeTimes->{
  3.8258008487087*^9, 3.825812787605503*^9, 3.825813202142953*^9, {
   3.8258139508788185`*^9, 3.825813952678999*^9}, {3.8258144552442503`*^9, 
   3.825814460499776*^9}, {3.8258147835370765`*^9, 3.8258148012568483`*^9}}],

Cell[TextData[{
 "The four adjacent digits in the 1000-digit number that have the greatest \
product are 9 \[Times] 9 \[Times] 8 \[Times] 9 = 5832.\n1000-digit number \
refers \[OpenCurlyDoubleQuote]",
 StyleBox["num",
  IgnoreSpellCheck->True],
 "\[CloseCurlyDoubleQuote].\nFind the thirteen adjacent digits in the \
1000-digit number that have the greatest product. What is the value of this \
product?"
}], "Text",
 CellChangeTimes->{
  3.825800863350164*^9, {3.825813207737512*^9, 3.8258132130720453`*^9}, {
   3.825813959910722*^9, 3.825813991831914*^9}, {3.825814150483777*^9, 
   3.8258141936080894`*^9}, {3.8258144654182673`*^9, 
   3.8258144700907345`*^9}, {3.8258148082505474`*^9, 
   3.8258148187715993`*^9}, {3.825820198049492*^9, 3.82582025373606*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
  "num", " ", "=", 
   "73167176531330624919225119674426574742355349194934969835203127745063262395\
783180169848018694788518438586156078911294949545950173795833195285320880551112\
540698747158523863050715693290963295227443043557668966489504452445231617318564\
030987111217223831136222989342338030813533627661428280644448664523874930358907\
296290491560440772390713810515859307960866701724271218839987979087922749219016\
997208880937766572733300105336788122023542180975125454059475224352584907711670\
556013604839586446706324415722155397536978179778461740649551492908625693219784\
686224828397224137565705605749026140797296865241453510047482166370484403199890\
008895243450658541227588666881164271714799244429282308634656748139191231628245\
861786645835912456652947654568284891288314260769004224219022671055626321111109\
370544217506941658960408071984038509624554443629812309878799272442849091888458\
015616609791913387549920052406368991256071760605886116467109405077541002256983\
15520005593572972571636269561882670428252483600823257530420752963450"}], 
  ";"}]], "Input",
 CellChangeTimes->{{3.825823667043357*^9, 3.8258236749521475`*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"Times", "@@@", 
   RowBox[{"Partition", "[", 
    RowBox[{
     RowBox[{"IntegerDigits", "[", "num", "]"}], ",", "13", ",", "1"}], 
    "]"}]}], "//", "Max"}]], "Code",
 CellChangeTimes->{{3.8258008701748466`*^9, 3.825800870184847*^9}, {
   3.8258013206097546`*^9, 3.825801324839755*^9}, {3.8258033293847523`*^9, 
   3.8258033489527087`*^9}, {3.8258034756953816`*^9, 3.825803653118122*^9}, {
   3.8258047718267374`*^9, 3.8258048613359365`*^9}, {3.825804929705773*^9, 
   3.8258049965254545`*^9}, {3.825805069542755*^9, 3.8258050827080717`*^9}, {
   3.825805684929288*^9, 3.825805685070302*^9}, {3.8258057231001043`*^9, 
   3.8258058436941624`*^9}, {3.8258059055603485`*^9, 3.8258059180736*^9}, {
   3.8258112762853765`*^9, 3.825811277207469*^9}, {3.825811542295975*^9, 
   3.825811549134659*^9}, {3.8258115889526405`*^9, 3.825811600162761*^9}, {
   3.8258118480897007`*^9, 3.8258119747707005`*^9}, 3.825812021009701*^9, {
   3.825812063630701*^9, 3.8258120884047008`*^9}, {3.8258123172877007`*^9, 
   3.8258123562703743`*^9}, {3.8258124007208185`*^9, 3.825812473061052*^9}, {
   3.8258125155913043`*^9, 3.82581251714646*^9}, {3.825812611664911*^9, 
   3.8258126249372377`*^9}, {3.825813796642397*^9, 3.8258138394896812`*^9}, {
   3.825814397362463*^9, 3.8258144035930853`*^9}, {3.825814494673193*^9, 
   3.825814528216547*^9}, {3.825815423699086*^9, 3.825815455135229*^9}, {
   3.8258163408517923`*^9, 3.8258163699427013`*^9}, {3.8258164121019163`*^9, 
   3.8258164693126373`*^9}, {3.8258234776484194`*^9, 3.825823480386693*^9}, {
   3.8258235309177456`*^9, 3.825823588446498*^9}, {3.8258236210057535`*^9, 
   3.8258236229699497`*^9}, {3.825823657095362*^9, 3.8258236801816707`*^9}}],

Cell[BoxData["23514624000"], "Output",
 CellChangeTimes->{3.82582362477113*^9, 3.8258236827619286`*^9}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]9. Special Pythagorean triplet", "Subsubsection",
 CellChangeTimes->{
  3.8258008487087*^9, 3.825812787605503*^9, 3.825813202142953*^9, {
   3.8258139508788185`*^9, 3.825813952678999*^9}, {3.8258144552442503`*^9, 
   3.825814460499776*^9}, {3.825824092487897*^9, 3.8258240945100994`*^9}}],

Cell[TextData[{
 "A Pythagorean triplet is a set of three natural numbers, a < b < c, for \
which,",
 Cell[BoxData[
  FormBox[
   SuperscriptBox["a", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 " + ",
 Cell[BoxData[
  FormBox[
   SuperscriptBox["b", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 " = ",
 Cell[BoxData[
  FormBox[
   SuperscriptBox["c", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 "\nFor example, ",
 Cell[BoxData[
  FormBox[
   SuperscriptBox["3", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 " + ",
 Cell[BoxData[
  FormBox[
   SuperscriptBox["4", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 " = 9 + 16 = 25 = ",
 Cell[BoxData[
  FormBox[
   SuperscriptBox["5", "2"], TraditionalForm]],
  FormatType->"TraditionalForm"],
 ".\nThere exists exactly one Pythagorean triplet for which a + b + c = \
1000.Find the product abc."
}], "Text",
 CellChangeTimes->{
  3.825800863350164*^9, {3.825813207737512*^9, 3.8258132130720453`*^9}, {
   3.825813959910722*^9, 3.825813991831914*^9}, {3.825814150483777*^9, 
   3.8258141936080894`*^9}, {3.8258144654182673`*^9, 
   3.8258144700907345`*^9}, {3.825824102175866*^9, 3.8258241113627844`*^9}, {
   3.825824176444292*^9, 3.825824248811528*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"a", " ", "*", " ", "b", "*", " ", "c"}], " ", "/.", " ", 
  RowBox[{"Solve", "[", 
   RowBox[{
    RowBox[{
     RowBox[{
      RowBox[{"a", " ", "+", " ", "b", " ", "+", " ", "c"}], " ", "\[Equal]", 
      " ", "1000"}], " ", "&&", " ", 
     RowBox[{
     "0", " ", "<", " ", "a", " ", "<", " ", "b", " ", "<", " ", "c"}], " ", "&&",
      " ", 
     RowBox[{
      RowBox[{
       SuperscriptBox["a", "2"], " ", "+", " ", 
       SuperscriptBox["b", "2"]}], " ", "\[Equal]", " ", 
      SuperscriptBox["c", "2"]}]}], ",", " ", 
    RowBox[{"{", 
     RowBox[{"a", " ", ",", " ", "b", ",", " ", "c"}], "}"}], ",", " ", 
    "Integers"}], "]"}]}]], "Code",
 CellChangeTimes->{{3.8258008701748466`*^9, 3.825800870184847*^9}, {
   3.8258013206097546`*^9, 3.825801324839755*^9}, {3.8258033293847523`*^9, 
   3.8258033489527087`*^9}, {3.8258034756953816`*^9, 3.825803653118122*^9}, {
   3.8258047718267374`*^9, 3.8258048613359365`*^9}, {3.825804929705773*^9, 
   3.8258049965254545`*^9}, {3.825805069542755*^9, 3.8258050827080717`*^9}, {
   3.825805684929288*^9, 3.825805685070302*^9}, {3.8258057231001043`*^9, 
   3.8258058436941624`*^9}, {3.8258059055603485`*^9, 3.8258059180736*^9}, {
   3.8258112762853765`*^9, 3.825811277207469*^9}, {3.825811542295975*^9, 
   3.825811549134659*^9}, {3.8258115889526405`*^9, 3.825811600162761*^9}, {
   3.8258118480897007`*^9, 3.8258119747707005`*^9}, 3.825812021009701*^9, {
   3.825812063630701*^9, 3.8258120884047008`*^9}, {3.8258123172877007`*^9, 
   3.8258123562703743`*^9}, {3.8258124007208185`*^9, 3.825812473061052*^9}, {
   3.8258125155913043`*^9, 3.82581251714646*^9}, {3.825812611664911*^9, 
   3.8258126249372377`*^9}, {3.825813796642397*^9, 3.8258138394896812`*^9}, {
   3.825814397362463*^9, 3.8258144035930853`*^9}, {3.825814494673193*^9, 
   3.825814528216547*^9}, {3.8258243024008865`*^9, 3.825824306802326*^9}, {
   3.8258245590605497`*^9, 3.8258246118468275`*^9}, {3.8258249179004297`*^9, 
   3.825824978292469*^9}, {3.8258250090335426`*^9, 3.825825011253764*^9}, {
   3.825825235782215*^9, 3.8258252557962165`*^9}, 3.8258254127729125`*^9, {
   3.825825447513386*^9, 3.8258254547381086`*^9}}],

Cell[BoxData[
 RowBox[{"{", "31875000", "}"}]], "Output",
 CellChangeTimes->{
  3.8258138755602875`*^9, 3.825814405156242*^9, {3.825814513840109*^9, 
   3.825814528618587*^9}, 3.8258248793125715`*^9, 3.825824979494589*^9, 
   3.825825012322871*^9, {3.8258252390945463`*^9, 3.8258252564532824`*^9}, 
   3.825825456037238*^9}]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["\[FilledSquare]10. Summation of primes", "Subsubsection",
 CellChangeTimes->{
  3.8258008487087*^9, 3.825812787605503*^9, 3.825813202142953*^9, {
   3.8258139508788185`*^9, 3.825813952678999*^9}, {3.8258144552442503`*^9, 
   3.825814460499776*^9}, {3.825824092487897*^9, 3.8258240945100994`*^9}, {
   3.8258258929399242`*^9, 3.8258258972263527`*^9}}],

Cell["\<\
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the \
primes below two million.\
\>", "Text",
 CellChangeTimes->{
  3.825800863350164*^9, {3.825813207737512*^9, 3.8258132130720453`*^9}, {
   3.825813959910722*^9, 3.825813991831914*^9}, {3.825814150483777*^9, 
   3.8258141936080894`*^9}, {3.8258144654182673`*^9, 
   3.8258144700907345`*^9}, {3.825824102175866*^9, 3.8258241113627844`*^9}, {
   3.825824176444292*^9, 3.825824248811528*^9}, {3.8258259031439447`*^9, 
   3.8258259081244426`*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{
  RowBox[{"Table", "[", 
   RowBox[{
    RowBox[{"Prime", "[", "i", "]"}], ",", " ", 
    RowBox[{"{", 
     RowBox[{"i", ",", " ", 
      RowBox[{"PrimePi", "[", 
       RowBox[{"2", " ", "*", " ", 
        RowBox[{"10", "^", "6"}]}], "]"}]}], "}"}]}], "]"}], " ", "//", " ", 
  "Total"}]], "Code",
 CellChangeTimes->{{3.8258008701748466`*^9, 3.825800870184847*^9}, {
   3.8258013206097546`*^9, 3.825801324839755*^9}, {3.8258033293847523`*^9, 
   3.8258033489527087`*^9}, {3.8258034756953816`*^9, 3.825803653118122*^9}, {
   3.8258047718267374`*^9, 3.8258048613359365`*^9}, {3.825804929705773*^9, 
   3.8258049965254545`*^9}, {3.825805069542755*^9, 3.8258050827080717`*^9}, {
   3.825805684929288*^9, 3.825805685070302*^9}, {3.8258057231001043`*^9, 
   3.8258058436941624`*^9}, {3.8258059055603485`*^9, 3.8258059180736*^9}, {
   3.8258112762853765`*^9, 3.825811277207469*^9}, {3.825811542295975*^9, 
   3.825811549134659*^9}, {3.8258115889526405`*^9, 3.825811600162761*^9}, {
   3.8258118480897007`*^9, 3.8258119747707005`*^9}, 3.825812021009701*^9, {
   3.825812063630701*^9, 3.8258120884047008`*^9}, {3.8258123172877007`*^9, 
   3.8258123562703743`*^9}, {3.8258124007208185`*^9, 3.825812473061052*^9}, {
   3.8258125155913043`*^9, 3.82581251714646*^9}, {3.825812611664911*^9, 
   3.8258126249372377`*^9}, {3.825813796642397*^9, 3.8258138394896812`*^9}, {
   3.825814397362463*^9, 3.8258144035930853`*^9}, {3.825814494673193*^9, 
   3.825814528216547*^9}, {3.8258243024008865`*^9, 3.825824306802326*^9}, {
   3.8258245590605497`*^9, 3.8258246118468275`*^9}, {3.8258249179004297`*^9, 
   3.825824978292469*^9}, {3.8258250090335426`*^9, 3.825825011253764*^9}, {
   3.825825235782215*^9, 3.8258252557962165`*^9}, 3.8258254127729125`*^9, {
   3.825825447513386*^9, 3.8258254547381086`*^9}, {3.8258260376863976`*^9, 
   3.825826040724701*^9}, {3.8258261339420223`*^9, 3.8258261356551933`*^9}, {
   3.82582627383463*^9, 3.82582640337463*^9}}],

Cell[BoxData["142913828922"], "Output",
 CellChangeTimes->{
  3.8258138755602875`*^9, 3.825814405156242*^9, {3.825814513840109*^9, 
   3.825814528618587*^9}, 3.8258248793125715`*^9, 3.825824979494589*^9, 
   3.825825012322871*^9, {3.8258252390945463`*^9, 3.8258252564532824`*^9}, 
   3.825825456037238*^9, 3.82582614173463*^9, 3.8258262866466303`*^9, 
   3.82582633311163*^9, {3.82582639218963*^9, 3.82582640711763*^9}}]
}, Open  ]]
}, Open  ]]
}, Open  ]]
},
WindowToolbars->"EditBar",
WindowSize->{1584, 826},
WindowMargins->{{-8, Automatic}, {Automatic, 0}},
CellContext->Notebook,
Magnification:>1.3 Inherited,
FrontEndVersion->"11.0 for Microsoft Windows (64-bit) (2016\:5e7410\:67088\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[580, 22, 154, 3, 117, "Title"],
Cell[CellGroupData[{
Cell[759, 29, 105, 1, 43, "Subsubsection"],
Cell[867, 32, 256, 5, 39, "Text"],
Cell[CellGroupData[{
Cell[1148, 41, 462, 14, 65, "Code"],
Cell[1613, 57, 141, 3, 39, "Output"]
}, Open  ]],
Cell[1769, 63, 83, 1, 39, "Text"],
Cell[CellGroupData[{
Cell[1877, 68, 904, 26, 162, "Code"],
Cell[2784, 96, 142, 3, 39, "Output"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[2975, 105, 106, 1, 43, "Subsubsection"],
Cell[3084, 108, 382, 7, 64, "Text"],
Cell[CellGroupData[{
Cell[3491, 119, 932, 25, 162, "Code"],
Cell[4426, 146, 184, 4, 43, "Output"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[4659, 156, 107, 1, 43, "Subsubsection"],
Cell[4769, 159, 178, 4, 50, "Text"],
Cell[CellGroupData[{
Cell[4972, 167, 201, 5, 84, "Code"],
Cell[5176, 174, 73, 1, 50, "Output"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[5298, 181, 109, 1, 55, "Subsubsection"],
Cell[5410, 184, 276, 5, 83, "Text"],
Cell[5689, 191, 499, 7, 50, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[6225, 203, 147, 2, 55, "Subsubsection"],
Cell[6375, 207, 324, 6, 83, "Text"],
Cell[CellGroupData[{
Cell[6724, 217, 1141, 16, 84, "Code"],
Cell[7868, 235, 80, 1, 50, "Output"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[7997, 242, 203, 3, 55, "Subsubsection"],
Cell[8203, 247, 1554, 48, 153, "Text"],
Cell[CellGroupData[{
Cell[9782, 299, 1431, 26, 84, "Code"],
Cell[11216, 327, 101, 1, 50, "Output"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[11366, 334, 247, 4, 55, "Subsubsection"],
Cell[11616, 340, 405, 7, 50, "Text"],
Cell[CellGroupData[{
Cell[12046, 351, 1220, 17, 84, "Code"],
Cell[13269, 370, 152, 3, 50, "Output"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[13470, 379, 311, 4, 55, "Subsubsection"],
Cell[13784, 385, 765, 15, 136, "Text"],
Cell[14552, 402, 1175, 18, 388, "Input"],
Cell[CellGroupData[{
Cell[15752, 424, 1718, 26, 101, "Code"],
Cell[17473, 452, 103, 1, 62, "Output"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[17625, 459, 309, 4, 67, "Subsubsection"],
Cell[17937, 465, 1275, 40, 146, "Text"],
Cell[CellGroupData[{
Cell[19237, 509, 2181, 39, 109, "Code"],
Cell[21421, 550, 324, 6, 62, "Output"]
}, Open  ]]
}, Open  ]],
Cell[CellGroupData[{
Cell[21794, 562, 356, 5, 67, "Subsubsection"],
Cell[22153, 569, 529, 10, 58, "Text"],
Cell[CellGroupData[{
Cell[22707, 583, 1962, 32, 101, "Code"],
Cell[24672, 617, 420, 6, 62, "Output"]
}, Open  ]]
}, Open  ]]
}, Open  ]]
}
]
*)

